package org.rcloud.io.service.impl;

import org.rcloud.io.Utils.ResultVo;
import org.rcloud.io.mapper.User_ArticleMapper;
import org.rcloud.io.model.User_Article;
import org.rcloud.io.service.User_ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Administrator on 2019/1/30.
 */
@Service(value = "User_ArticleService")
public class User_ArticleServiceImpl implements User_ArticleService{

    @Autowired
    private User_ArticleMapper user_articleMapper;

    @Override
    public ResultVo save(User_Article params) {

        if (params.equals("") || params == null) {
            return ResultVo.setError("传入数据为空");
        } else {
            try {
                user_articleMapper.insertSelective(params);
                return ResultVo.setOK(null);
            } catch (Exception e) {
                e.printStackTrace();
                return ResultVo.setError(e.getMessage());
            }
        }

    }

    @Override
    public ResultVo find(User_Article params) {

        try {
            User_Article user_article = user_articleMapper.selectByKey(params);
            return ResultVo.setOK(user_article);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultVo.setError(e.getMessage());
        }

    }


}
